﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace Payton.WP7.Common.Configration
{
    public class ConfigrationManager
    {
        ConfigrationManager()
        {
        }

        static ConfigrationManager()
        {
            Initalize();
        }

        static ConfigrationManager _current;
        public static ConfigrationManager Current
        {
            get { if (_current == null) _current = new ConfigrationManager(); return _current; }
        }

        static Dictionary<SNSProviderType, OAuthSettings> _dic = new Dictionary<SNSProviderType, OAuthSettings>();

        private static void Initalize()
        {
            _dic.Add(SNSProviderType.Sina, new OAuthSettings()
            {
                CLIENT = "http://api.t.sina.com.cn",
                CONSUMER_KEY = "2980444272",
                CONSUMER_KEY_SECRET = "309ee9a40e2e7e4335bb56fdb335e743",
                OAUTH_VERSION = "1.0",
                PATH_ACCESS_TOKEN = "/oauth/access_token",
                PATH_AUTHORIZE = "/oauth/authorize",
                PATH_REQUEST_TOKEN = "/oauth/request_token"
            });
            _dic.Add(SNSProviderType.Tencent, new OAuthSettings()
            {
                CLIENT = "https://open.t.qq.com",
                CONSUMER_KEY = "4b877e498463466191c06381ba403f9d",
                CONSUMER_KEY_SECRET = "8c7b30927ee8cb44d94d5a60326d2e6f",
                OAUTH_VERSION = "1.0",
                PATH_ACCESS_TOKEN = "/cgi-bin/access_token",
                PATH_AUTHORIZE = "/cgi-bin/authorize",
                PATH_REQUEST_TOKEN = "/cgi-bin/request_token"
            });
            _dic.Add(SNSProviderType.RenRen, new OAuthSettings()
            {
                CLIENT = "https://graph.renren.com",
                CONSUMER_KEY = "e2c0ca52930e40029cf1054b78b53e2b",
                CONSUMER_KEY_SECRET = "fb74738ed7414d77835f5d86a36d2227",
                OAUTH_VERSION = "1.0",
                PATH_ACCESS_TOKEN = "/oauth/token",
                PATH_AUTHORIZE = "/oauth/authorize",
                PATH_REQUEST_TOKEN = "",
                CALLBACK_URL = "http://graph.renren.com/oauth/login_success.html"
            });
        }

        public OAuthSettings this[SNSProviderType index]
        {
            get { if (_dic.ContainsKey(index))return _dic[index]; return null; }
        }

        public void Save()
        {

        }

        public void Load()
        {

        }
    }
}
